﻿<Window x:Class="Intuipic.DeletionWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:io="clr-namespace:System.IO;assembly=mscorlib"
	xmlns:local="clr-namespace:Intuipic" 
	xmlns:converters="clr-namespace:Intuipic.Converters"
    Title="Confirm Deletion"
	WindowStartupLocation="CenterScreen"
	WindowStyle="ToolWindow" 
	ShowInTaskbar="False"
	Width="450"
	Height="300"
	MinWidth="300"
	MinHeight="150" 
	Style="{StaticResource {x:Type Window}}">
	<Window.Resources>
		<converters:BitmapFrameConverter x:Key="BitmapFrameConverter" DecodePixelWidth="250"/>

		<converters:BitmapOrientationConverter x:Key="BitmapOrientationConverter"/>

		<DataTemplate DataType="{x:Type local:DeletionWindow+FileInformation}">
			<StackPanel Orientation="Horizontal">
				<CheckBox IsChecked="{Binding Delete}"/>
				<TextBlock Text="{Binding FileInfo.Name}" Style="{StaticResource DeletionItemStyle}"/>
			</StackPanel>
		</DataTemplate>
		
		<DataTemplate x:Key="ImageTemplate">
			<DockPanel Style="{StaticResource ImageDeletionPanelStyle}">
				<Image Source="{Binding FileInfo.FullName, Mode=OneWay, Converter={StaticResource BitmapFrameConverter}}">
					<Image.LayoutTransform>
						<RotateTransform Angle="{Binding FileInfo.FullName, Mode=OneWay, Converter={StaticResource BitmapOrientationConverter}}"/>
					</Image.LayoutTransform>
				</Image>
			</DockPanel>
		</DataTemplate>
	</Window.Resources>
	
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*" MinHeight="50"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="2*" MinWidth="50"/>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition Width="3*" MinWidth="50"/>
		</Grid.ColumnDefinitions>

		<TextBlock Grid.ColumnSpan="3" Style="{StaticResource HeaderTextStyle}">The following files were marked for deletion. Please make any desired changes before confirming the deletion.</TextBlock>

		<ListBox Grid.Row="1" ItemsSource="{Binding Files}" IsSynchronizedWithCurrentItem="True" Style="{StaticResource DeletionListBoxStyle}"/>

		<GridSplitter Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
			
		<ContentControl Grid.Row="1" Grid.Column="2" ContentTemplate="{StaticResource ImageTemplate}" Content="{Binding Files}" MinWidth="50"/>
		
		<StackPanel Grid.Row="2" Grid.ColumnSpan="3" HorizontalAlignment="Right" Orientation="Horizontal">
			<Button Content="_Delete Checked Files" Click="DeleteFiles"/>
			<Button Content="Do_n't Delete Files" Click="DontDeleteFiles"/>
			<Button Content="_Cancel" IsCancel="True" IsDefault="True"/>
		</StackPanel>
    </Grid>
</Window>
